<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var a = "gender"
        /* 
            点语法的引用
        */
        var o = {
            name: "张三",
            age: 18
        }
        /* 将a当做一个属性 */
        // o.a = "男"

        // o["gender"] = "男"    
        /* 中括号语法可以做到,中括号里面本质就是一个变量的 */ 
        // o[a] = "男"

        /* 变量的命名规则 Accept-Encoding */
        // o.Accept-Encoding = "王哥"   //点语法的属性要遵守变量的命名规则
        o["Accept-Encoding"] = "文哥"
        console.log(o);
    </script>
</body>

</html>